ShareCom Windows 3.1 Release Notes The following special considerations should be taken into account concerning the PST Ids RPC port to Windows 3.1. Running the Samples The distribution media has a directory named TESTRPC which contains two sample programs, a client and a server. To run these you need a PC with Windows 3.1, the Microsoft C compiler and a working, installed TCP/IP network with Winsock compatibility. The software has not been tested with other compilers but should work. The settings to use are presented later. The software has been tested with FTP Software's PC/TCP package but should work with other Winsock implementations as well. Each program has a make file for NMAKE, named after the program, in the same directory. running the commands nmake -f clitest.mak nmake -f srvtest.mak should build the two executables. The executables are Windows Quick Win applications. The environment should be set up so that the compiler finds all necessary system headers and libraries, including WINSOCK.H. The applications take command line arguments for specifying the listen and connect addresses. srvtest gizmo:1111 would start the server listening at port 1111 on host gizmo. clitest gizmo:1177 gizmo 1111 would start the client sample, listening at 1177 on gizmo and connect to a srvtest application listening at 1111 on gizmo. The client will exit after completing the test suite. The server will run indefinitely. Specifying a this command line argument to the client will make it kill the server also, so that both terminate at the end of the suite and all listen addresses and other network resources get freed. Threading This port implements threads by allocating one large stack that is subsequently divided between threads. This sets a maximum of 64K of stack for all threads combined. It is important to specify sufficient stack space at link time (see the /STACK linker switch) and to specify its usage with the PrpcSetThreadParams function. Scheduling Windows has no form of preemptive scheduling. This means that thread switches will take place only in the following situations: - The server thread starts a service. - A service thread completes its task. - A service thread calls process_allow_schedule(). - A blocking condition is detected on I/O. Data Types This is the only 16-bit release of ShareCom. Special care must therefore be taken with passing arguments to functions taking an indefinite number of arguments. - All arguments of PrpcFuture must be 32 bit. If they are not so implicitly they should be cast to such. For instance, do not write: PrpcFuture (server, &s_multiplt, 10, 10); instead, you should write PrpcFuture (server, &s_multiplt, (long) 10, (long) 10); All values returned by future service functions must also be 32 bit. In general the int data type should be avoided. Distribution Disks ShareCom for Windows is packaged as one DLL including levels 1 and 2 plus one static library implementing Level 3, Distributed Objects. These should be linked against winsock.lib and any other libraries the application may require. Using Microsoft Visual C++ When a project uses ShareCom the following settings should be in effect: Compiles: Memory Model: Large, SS == DS Linker: Libraries: dkobj.lib (if Distributed Objects) and diskit.lib (RPC) Stack Size: Sufficiently large, e.g. 40000. ShareCom does work with Quick Win applications. The following script will compile and link a sample ShareCom application. cl -c -Gs -G3 -GA -Fc -W3 -Zi -AL -Od -FR -I..\ -I..\..\ srvtest.c link /CO /STACK:40000 /noe /NOD srvtest.obj ,srvtest.exe,,c:\pctcp\winsock+..\diskit.lib+oldnames+libw+llibcew,, cl -c -Gs -G3 -GA -Fc -W3 -Zi -AL -Od -FR -I..\ -I..\..\ clitest.c link /CO /STACK:40000 /noe /NOD clitest.obj ,clitest.exe,,c:\pctcp\winsock+..\diskit.lib+oldnames+libw+llibcew+winsock,, Standard I/O diskit.dll exports a definition of printf. When called, this creates a file named SSTD.OUT in the current directory and appends whatever is to be printed. In normal operation ShareCom does not use this. Some error messages that would otherwise go to the console will in some error conditions be printed there. When linking against say he Quick Win libraries one will make sure that the ShareCom printf be shadowed by Quick Win's. Passing Floats Floats and doubles are passed as parts of structures or arrays just as any other data types. However, floats cannot be passed as function arguments or return values without special measures. To pass a single float or double with a minimal amount of extra coding and without extra memory management it is possible to declare the argument as DV_ARRAY_OF_FLOAT and: 1. In thr actual call: .. PrpcFuture (server, & service, box_float (11.11), box_double (27.93)); 2. In the RPC server function: long sf_service (float * fp, double * dp) { ....printf ("%f, %lf", * fp, * dp); Or in C++ caddr_t sf_service (float & f, double & d) { ....printf ("%f, %lf", f, d); return (box_double ( f * d )); } In all cases, all temporary storage for boxes will be automatically freed. To return a double, thr function should simply be of type caddr_t and return box_double (d). The client can then retrieve it with umbox_float )PrpcSync (....Thr memory allocated by the box_double will be automatically freed by the system at the returning end. The receiver's box will be freed by PrpcFutureFree or PrpcSync. Thr procedure to return a float is similar. A float being thr same size as a long could also be cast to a long for return and re-cast back to float at the receiving end. Winsock Implementations ShareCom has been tested with the FTP Software PC TCP Windock implementation. Winsock installation parameters affect the way the ShareCom package performs. For instance, it has been found that Winsock hangs for lack of buffers when there are too many unread messages in the send or receive buffers. The following is an excerpt of a PCTCP.INI file that does work. [pctcp general] host-name = via domain = ctron full-name = Orri root time-zone = EST time-zone-offset = 300 use-old-init-scheme = no [pctcp kernel] interface = ifcust 0 serial-number = 3997-4169-0115 authentication-key = 1738-6676-8983 window = 2048 low-window = 0 use-emm = no host-table = c:\pctcp\hosts kernel-int = 0x62 ip-ttl = 64 ip-precedence = routine ip-precedence-matching = lax ip-security = none ip-delay = high ip-reliability = low ip-throughput = low large-packets = 5 small-packets = 5 tcp-connections = 20 udp-connections = 20 router-discovery = no mtu-discovery = yes [pctcp ifcust 0] broadcast-address = 255.255.255.255 ip-address = 134.141.59.123 router = 134.141.59.1 subnet-mask = 255.255.0.0 [pctcp lpr] banner = yes [pctcp print] spool = c:\predir.spl [pctcp pd-pctcp] default = ipx [pctcp pd-pctcp ipx] retain-header = 0 protocol = UDP type-port = 0x8137,213 [pctcp netbios] scope = [pctcp host] umask = 644 2222222222 [pctcp serial n] port = 1 io-addr = 0x03f8 irq = 4 baud = 2400 hardware-flow-control = on [pctcp comscrpt hostname] dialup = c:\pctcp\dialup.scr hangup = c:\pctcp\hangup.scr mru = 1500 accm = 0x000A0000 addr-ctrl-field-comp = on prot-field-comp = on local-ip-address = 0.0.0.0 remote-ip-address = 0.0.0.0 [pctcp time] dst-begins = 94 dst-ends = 299 [pctcp install] bindir = C:\PCTCP etcdir = C:\PCTCP kernel-name = ETHDRV.EXE major-version = 2 minor-version = 2 patch-level = 0 do-kappconf = yes configure-driver = yes